﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ToolPositioning.CApTPJumpToolCommand
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Windows.Input;


namespace DnProcessSimulateCommands.ToolPositioning;

public class CApTPJumpToolCommand : ICommand
{
  private readonly Action _execute;
  private readonly Func<bool> _canExecute;

  public event EventHandler<EventArgs> CommandExecuted;

  public CApTPJumpToolCommand(Action execute, Func<bool> canExecute)
  {
    this._execute = execute;
    this._canExecute = canExecute;
  }

  public event EventHandler CanExecuteChanged
  {
    add => CommandManager.RequerySuggested += value;
    remove => CommandManager.RequerySuggested -= value;
  }

  public bool CanExecute(object parameter) => this._canExecute == null || this._canExecute();

  public void Execute(object parameter)
  {
    this._execute();
    if (this.CommandExecuted == null)
      return;
    this.CommandExecuted((object) this, EventArgs.Empty);
  }
}
